<?php


namespace App\Transformers\System;


use App\Models\SystemMenu;
use League\Fractal\TransformerAbstract;

class SystemMenuTransformer extends TransformerAbstract
{
    public function transform(SystemMenu $data)
    {
        return [
            'id' => $data->id,
            'pid' => $date->pid ?? '',
            'icon' => $date->icon ?? '',
            'menu_name' => $date->menu_name ?? '',
            'module' => $date->module ?? '',
            'controller' => $date->controller ?? '',
            'action' => $date->action ?? '',
            'api_url' => $date->api_url ?? '',
            'methods' => $date->methods ?? '',
            'params' => $date->params ?? '',
            'sort' => $date->sort ?? '',
            'menu_path' => $date->menu_path ?? '',
            'path' => $date->path ?? '',
            'unique_auth' => $date->header ?? '',
            'deleted_at' => $data->deleted_at ? $data->deleted_at->format("Y-m-d H:i:s") : '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
